package com.armani.mapper;

import com.armani.entity.ItemSpu;
import com.armani.model.ItemModel;
import com.armani.model.SpuModel;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @ClassName SpuMapper
 * @Description 商品spu映射接口
 * @Author Admin
 * @Date 2021/11/27 17:47
 * @Version 1.0
 **/

public interface SpuMapper {
    List<ItemSpu> pageSearch(@Param(value = "startRow") Integer startRow,
                             @Param(value = "limit") Integer limit,
                             @Param(value = "id") Integer id);

    Integer getCount(@Param(value = "id") Integer id);

    Integer insert(@Param(value = "name") String name,
                   @Param(value = "subName") String subName,
                   @Param(value = "typeId1") Integer typeId1,
                   @Param(value = "typeId2") Integer typeId2,
                   @Param(value = "method") String method,
                   @Param(value = "saleAble") Integer saleAble,
                   @Param(value = "creatTime") Date creatTime,
                   @Param(value = "lastTime") Date lastTime);

    Integer update(@Param(value = "id") Integer id,
                   @Param(value = "name") String name,
                   @Param(value = "subName") String subName,
                   @Param(value = "typeId1") Integer typeId1,
                   @Param(value = "typeId2") Integer typeId2,
                   @Param(value = "method") String method,
                   @Param(value = "saleAble") Integer saleAble,
                   @Param(value = "creatTime") Date creatTime,
                   @Param(value = "lastTime") Date lastTime);

    Integer delete(@Param(value = "id") Integer id);

    /**
     * 商品详情条件检索+分页
     *
     * @param params 查询的参数
     * @return spu列表集合
     */
    List<ItemModel> selectAll(Map<String, Object> params);

    /**
     * 商品详情总条数
     *
     * @param params 查询的参数
     * @return 总条数
     */
    Integer count(Map<String, Object> params);

    /**
     * 根据id更新saleAble
     *
     * @param params 参数（id，saleAble）
     * @return 影响行
     */
    Integer isSaleAble(Map<String, Object> params);

    /**
     * 添加spu
     * @param itemModel 参数
     * @return 影响行
     */
    Integer insertSpu(ItemModel itemModel);
}
